package com.icegame.server;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * 应用模块名称<p>
 * 代码描述<p>
 * Company: 南京雪糕网络科技有限公司<p>
 *
 * @author 18486
 * @since 2019/9/28 14:05
 */
public class FTPServer {

    private static final Logger log = LoggerFactory.getLogger(FTPServer.class);

    public static void main(String[] args){
        try {
            ServerSocket serverSocket = new ServerSocket(5000);
            log.info("TCP 服务正在 5000 端口上运行");
            int num = 0;
            while (true){
                Socket clientSocket = serverSocket.accept();
                log.info("客户端" + " " + clientSocket.getInetAddress() + ":" + clientSocket.getPort() + "正在链接");
                FTPServerWorker worker = new FTPServerWorker(clientSocket, num);
                new Thread(worker).start();
                num++;
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
